/*
 * client.h
 *
 *  Created on: Apr 29, 2012
 *      Author: root
 */

#ifndef CLIENTS_H_
#define CLIENTS_H_

#include 	"readBuffer.h"

#define	CLOSING		1

typedef struct cl {
	int			state;
	int 		connfd;
	char *		from;
	char *		user;     // buffer for reading a line
	ReadBuffer * readBuffer;  // internal buffer used in readcrlf_r()
	struct cl *	next;
} Client;

Client *	getClientList();
char *		getUser(Client *client);
int			getSocket(Client *client);
Client *	findClient(char *userID);
Client *	createClient(const int connfd);
void 		destroyClient(Client *client);
ssize_t 	readClient(Client *client);

#endif /* CLIENTS_H_ */
